.class public Lcom/netease/newsreader/util/ThemeSettingsHelper;
.super Ljava/lang/Object;
.source "ThemeSettingsHelper.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/netease/newsreader/util/ThemeSettingsHelper$ThemeCallback;
    }
.end annotation


# static fields
.field private static final TAG:Ljava/lang/String; = "ThemeSettingsHelper"

.field public static final THEME_DEFAULT:Ljava/lang/String; = "default_theme"

.field public static final THEME_NIGHT:Ljava/lang/String; = "night_theme"

.field private static sThemeSettingsHelper:Ljava/lang/ref/WeakReference;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/lang/ref/WeakReference",
            "<",
            "Lcom/netease/newsreader/util/ThemeSettingsHelper;",
            ">;"
        }
    .end annotation
.end field


# instance fields
.field private final mCallbacks:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList",
            "<",
            "Ljava/lang/ref/WeakReference",
            "<",
            "Lcom/netease/newsreader/util/ThemeSettingsHelper$ThemeCallback;",
            ">;>;"
        }
    .end annotation
.end field

.field private mThemeContext:Landroid/content/Context;

.field private mThemePackageName:Ljava/lang/String;


# direct methods
.method private constructor <init>(Landroid/content/Context;)V
    .locals 4
    .parameter "context"

    .prologue
    .line 44
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 28
    new-instance v2, Ljava/util/ArrayList;

    invoke-direct {v2}, Ljava/util/ArrayList;-><init>()V

    iput-object v2, p0, Lcom/netease/newsreader/util/ThemeSettingsHelper;->mCallbacks:Ljava/util/ArrayList;

    .line 47
    invoke-static {p1}, Landroid/preference/PreferenceManager;->getDefaultSharedPreferences(Landroid/content/Context;)Landroid/content/SharedPreferences;

    move-result-object v0

    .line 48
    .local v0, sp:Landroid/content/SharedPreferences;
    const-string v2, "theme"

    const-string v3, "default_theme"

    invoke-interface {v0, v2, v3}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    .line 49
    .local v1, theme:Ljava/lang/String;
    invoke-direct {p0, p1, v1}, Lcom/netease/newsreader/util/ThemeSettingsHelper;->initTheme(Landroid/content/Context;Ljava/lang/String;)V

    .line 50
    return-void
.end method

.method private getDefaultResourceValue(Landroid/content/Context;I)Ljava/lang/Object;
    .locals 3
    .parameter "context"
    .parameter "id"

    .prologue
    .line 92
    invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v0

    .line 93
    .local v0, res:Landroid/content/res/Resources;
    invoke-virtual {v0, p2}, Landroid/content/res/Resources;->getResourceTypeName(I)Ljava/lang/String;

    move-result-object v1

    .line 94
    .local v1, resType:Ljava/lang/String;
    invoke-direct {p0, v0, p2, v1}, Lcom/netease/newsreader/util/ThemeSettingsHelper;->getResourceValue(Landroid/content/res/Resources;ILjava/lang/String;)Ljava/lang/Object;

    move-result-object v2

    return-object v2
.end method

.method private getResourceValue(Landroid/content/res/Resources;ILjava/lang/String;)Ljava/lang/Object;
    .locals 2
    .parameter "res"
    .parameter "id"
    .parameter "resType"

    .prologue
    .line 98
    const/4 v0, 0x0

    .line 99
    .local v0, o:Ljava/lang/Object;
    const-string v1, "drawable"

    invoke-virtual {v1, p3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_1

    .line 100
    invoke-virtual {p1, p2}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;

    move-result-object v0

    .line 104
    .end local v0           #o:Ljava/lang/Object;
    :cond_0
    :goto_0
    return-object v0

    .line 101
    .restart local v0       #o:Ljava/lang/Object;
    :cond_1
    const-string v1, "color"

    invoke-virtual {v1, p3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_0

    .line 102
    invoke-virtual {p1, p2}, Landroid/content/res/Resources;->getColorStateList(I)Landroid/content/res/ColorStateList;

    move-result-object v0

    .local v0, o:Landroid/content/res/ColorStateList;
    goto :goto_0
.end method

.method private getResourceValueByName(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Object;
    .locals 4
    .parameter "context"
    .parameter "resName"
    .parameter "type"

    .prologue
    .line 80
    invoke-virtual {p2}, Ljava/lang/String;->toLowerCase()Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/String;->trim()Ljava/lang/String;

    move-result-object p2

    .line 81
    invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v2

    .line 82
    .local v2, res:Landroid/content/res/Resources;
    invoke-virtual {p1}, Landroid/content/Context;->getPackageName()Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v2, p2, p3, v3}, Landroid/content/res/Resources;->getIdentifier(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I

    move-result v0

    .line 83
    .local v0, id:I
    if-eqz v0, :cond_0

    .line 84
    invoke-direct {p0, v2, v0, p3}, Lcom/netease/newsreader/util/ThemeSettingsHelper;->getResourceValue(Landroid/content/res/Resources;ILjava/lang/String;)Ljava/lang/Object;

    move-result-object v1

    .line 88
    :goto_0
    return-object v1

    :cond_0
    const/4 v1, 0x0

    goto :goto_0
.end method

.method private getThemeContext(Landroid/content/Context;Ljava/lang/String;)Landroid/content/Context;
    .locals 2
    .parameter "context"
    .parameter "themePackage"

    .prologue
    .line 108
    iput-object p2, p0, Lcom/netease/newsreader/util/ThemeSettingsHelper;->mThemePackageName:Ljava/lang/String;

    .line 109
    const-string v1, "default_theme"

    invoke-virtual {v1, p2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-nez v1, :cond_0

    const-string v1, "night_theme"

    invoke-virtual {v1, p2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_1

    .line 110
    :cond_0
    invoke-virtual {p1}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;

    move-result-object v1

    .line 117
    :goto_0
    return-object v1

    .line 113
    :cond_1
    const/4 v1, 0x3

    :try_start_0
    invoke-virtual {p1, p2, v1}, Landroid/content/Context;->createPackageContext(Ljava/lang/String;I)Landroid/content/Context;
    :try_end_0
    .catch Landroid/content/pm/PackageManager$NameNotFoundException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v1

    goto :goto_0

    .line 115
    :catch_0
    move-exception v0

    .line 116
    .local v0, e:Landroid/content/pm/PackageManager$NameNotFoundException;
    const-string v1, "default_theme"

    iput-object v1, p0, Lcom/netease/newsreader/util/ThemeSettingsHelper;->mThemePackageName:Ljava/lang/String;

    .line 117
    invoke-virtual {p1}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;

    move-result-object v1

    goto :goto_0
.end method

.method private getThemeResource(Landroid/content/Context;I)Ljava/lang/Object;
    .locals 6
    .parameter "context"
    .parameter "id"

    .prologue
    .line 53
    const/4 v0, 0x0

    .line 55
    .local v0, o:Ljava/lang/Object;
    const-string v4, "night_theme"

    iget-object v5, p0, Lcom/netease/newsreader/util/ThemeSettingsHelper;->mThemePackageName:Ljava/lang/String;

    invoke-virtual {v4, v5}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v4

    if-eqz v4, :cond_2

    .line 57
    :try_start_0
    invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v1

    .line 58
    .local v1, res:Landroid/content/res/Resources;
    new-instance v4, Ljava/lang/StringBuilder;

    const-string v5, "night_"

    invoke-direct {v4, v5}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v1, p2}, Landroid/content/res/Resources;->getResourceEntryName(I)Ljava/lang/String;

    move-result-object v5

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    .line 59
    .local v2, resName:Ljava/lang/String;
    invoke-virtual {v1, p2}, Landroid/content/res/Resources;->getResourceTypeName(I)Ljava/lang/String;

    move-result-object v3

    .line 60
    .local v3, type:Ljava/lang/String;
    iget-object v4, p0, Lcom/netease/newsreader/util/ThemeSettingsHelper;->mThemeContext:Landroid/content/Context;

    invoke-direct {p0, v4, v2, v3}, Lcom/netease/newsreader/util/ThemeSettingsHelper;->getResourceValueByName(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Object;
    :try_end_0
    .catch Landroid/content/res/Resources$NotFoundException; {:try_start_0 .. :try_end_0} :catch_1

    move-result-object v0

    .line 72
    .end local v0           #o:Ljava/lang/Object;
    .end local v1           #res:Landroid/content/res/Resources;
    .end local v2           #resName:Ljava/lang/String;
    .end local v3           #type:Ljava/lang/String;
    :cond_0
    :goto_0
    if-nez v0, :cond_1

    .line 73
    invoke-direct {p0, p1, p2}, Lcom/netease/newsreader/util/ThemeSettingsHelper;->getDefaultResourceValue(Landroid/content/Context;I)Ljava/lang/Object;

    move-result-object v0

    .line 76
    :cond_1
    return-object v0

    .line 63
    .restart local v0       #o:Ljava/lang/Object;
    :cond_2
    const-string v4, "default_theme"

    iget-object v5, p0, Lcom/netease/newsreader/util/ThemeSettingsHelper;->mThemePackageName:Ljava/lang/String;

    invoke-virtual {v4, v5}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v4

    if-nez v4, :cond_0

    .line 65
    :try_start_1
    invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v1

    .line 66
    .restart local v1       #res:Landroid/content/res/Resources;
    invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v4

    invoke-virtual {v4, p2}, Landroid/content/res/Resources;->getResourceEntryName(I)Ljava/lang/String;

    move-result-object v2

    .line 67
    .restart local v2       #resName:Ljava/lang/String;
    invoke-virtual {v1, p2}, Landroid/content/res/Resources;->getResourceTypeName(I)Ljava/lang/String;

    move-result-object v3

    .line 68
    .restart local v3       #type:Ljava/lang/String;
    iget-object v4, p0, Lcom/netease/newsreader/util/ThemeSettingsHelper;->mThemeContext:Landroid/content/Context;

    invoke-direct {p0, v4, v2, v3}, Lcom/netease/newsreader/util/ThemeSettingsHelper;->getResourceValueByName(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Object;
    :try_end_1
    .catch Landroid/content/res/Resources$NotFoundException; {:try_start_1 .. :try_end_1} :catch_0

    move-result-object v0

    goto :goto_0

    .line 69
    .end local v1           #res:Landroid/content/res/Resources;
    .end local v2           #resName:Ljava/lang/String;
    .end local v3           #type:Ljava/lang/String;
    :catch_0
    move-exception v4

    goto :goto_0

    .line 61
    :catch_1
    move-exception v4

    goto :goto_0
.end method

.method public static final getThemeSettingsHelper(Landroid/content/Context;)Lcom/netease/newsreader/util/ThemeSettingsHelper;
    .locals 2
    .parameter "context"

    .prologue
    .line 37
    sget-object v0, Lcom/netease/newsreader/util/ThemeSettingsHelper;->sThemeSettingsHelper:Ljava/lang/ref/WeakReference;

    if-eqz v0, :cond_0

    sget-object v0, Lcom/netease/newsreader/util/ThemeSettingsHelper;->sThemeSettingsHelper:Ljava/lang/ref/WeakReference;

    invoke-virtual {v0}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object v0

    if-nez v0, :cond_1

    .line 38
    :cond_0
    new-instance v0, Ljava/lang/ref/WeakReference;

    new-instance v1, Lcom/netease/newsreader/util/ThemeSettingsHelper;

    .line 39
    invoke-direct {v1, p0}, Lcom/netease/newsreader/util/ThemeSettingsHelper;-><init>(Landroid/content/Context;)V

    .line 38
    invoke-direct {v0, v1}, Ljava/lang/ref/WeakReference;-><init>(Ljava/lang/Object;)V

    sput-object v0, Lcom/netease/newsreader/util/ThemeSettingsHelper;->sThemeSettingsHelper:Ljava/lang/ref/WeakReference;

    .line 41
    :cond_1
    sget-object v0, Lcom/netease/newsreader/util/ThemeSettingsHelper;->sThemeSettingsHelper:Ljava/lang/ref/WeakReference;

    invoke-virtual {v0}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/netease/newsreader/util/ThemeSettingsHelper;

    return-object v0
.end method

.method private initTheme(Landroid/content/Context;Ljava/lang/String;)V
    .locals 1
    .parameter "context"
    .parameter "theme"

    .prologue
    .line 171
    invoke-direct {p0, p1, p2}, Lcom/netease/newsreader/util/ThemeSettingsHelper;->getThemeContext(Landroid/content/Context;Ljava/lang/String;)Landroid/content/Context;

    move-result-object v0

    iput-object v0, p0, Lcom/netease/newsreader/util/ThemeSettingsHelper;->mThemeContext:Landroid/content/Context;

    .line 172
    return-void
.end method


# virtual methods
.method public changeTheme(Landroid/content/Context;Ljava/lang/String;)V
    .locals 10
    .parameter "context"
    .parameter "newTheme"

    .prologue
    .line 175
    iget-object v7, p0, Lcom/netease/newsreader/util/ThemeSettingsHelper;->mCallbacks:Ljava/util/ArrayList;

    monitor-enter v7

    .line 176
    :try_start_0
    iget-object v2, p0, Lcom/netease/newsreader/util/ThemeSettingsHelper;->mThemePackageName:Ljava/lang/String;

    .line 178
    .local v2, lastTheme:Ljava/lang/String;
    invoke-direct {p0, p1, p2}, Lcom/netease/newsreader/util/ThemeSettingsHelper;->initTheme(Landroid/content/Context;Ljava/lang/String;)V

    .line 180
    iget-object v6, p0, Lcom/netease/newsreader/util/ThemeSettingsHelper;->mThemePackageName:Ljava/lang/String;

    invoke-virtual {v6, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v6

    if-nez v6, :cond_0

    .line 182
    invoke-static {p1}, Landroid/preference/PreferenceManager;->getDefaultSharedPreferences(Landroid/content/Context;)Landroid/content/SharedPreferences;

    move-result-object v5

    .line 183
    .local v5, sp:Landroid/content/SharedPreferences;
    invoke-interface {v5}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;

    move-result-object v6

    const-string v8, "theme"

    iget-object v9, p0, Lcom/netease/newsreader/util/ThemeSettingsHelper;->mThemePackageName:Ljava/lang/String;

    invoke-interface {v6, v8, v9}, Landroid/content/SharedPreferences$Editor;->putString(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;

    move-result-object v6

    invoke-interface {v6}, Landroid/content/SharedPreferences$Editor;->commit()Z

    .line 185
    iget-object v6, p0, Lcom/netease/newsreader/util/ThemeSettingsHelper;->mCallbacks:Ljava/util/ArrayList;

    invoke-virtual {v6}, Ljava/util/ArrayList;->size()I

    move-result v4

    .line 186
    .local v4, size:I
    const/4 v1, 0x0

    .local v1, i:I
    :goto_0
    if-lt v1, v4, :cond_1

    .line 175
    .end local v1           #i:I
    .end local v4           #size:I
    .end local v5           #sp:Landroid/content/SharedPreferences;
    :cond_0
    monitor-exit v7

    .line 197
    return-void

    .line 187
    .restart local v1       #i:I
    .restart local v4       #size:I
    .restart local v5       #sp:Landroid/content/SharedPreferences;
    :cond_1
    iget-object v6, p0, Lcom/netease/newsreader/util/ThemeSettingsHelper;->mCallbacks:Ljava/util/ArrayList;

    invoke-virtual {v6, v1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v3

    check-cast v3, Ljava/lang/ref/WeakReference;

    .line 188
    .local v3, r:Ljava/lang/ref/WeakReference;,"Ljava/lang/ref/WeakReference<Lcom/netease/newsreader/util/ThemeSettingsHelper$ThemeCallback;>;"
    if-eqz v3, :cond_2

    .line 189
    invoke-virtual {v3}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/netease/newsreader/util/ThemeSettingsHelper$ThemeCallback;

    .line 190
    .local v0, callback:Lcom/netease/newsreader/util/ThemeSettingsHelper$ThemeCallback;
    if-eqz v0, :cond_2

    .line 191
    invoke-interface {v0}, Lcom/netease/newsreader/util/ThemeSettingsHelper$ThemeCallback;->applyTheme()V

    .line 186
    .end local v0           #callback:Lcom/netease/newsreader/util/ThemeSettingsHelper$ThemeCallback;
    :cond_2
    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    .line 175
    .end local v1           #i:I
    .end local v2           #lastTheme:Ljava/lang/String;
    .end local v3           #r:Ljava/lang/ref/WeakReference;,"Ljava/lang/ref/WeakReference<Lcom/netease/newsreader/util/ThemeSettingsHelper$ThemeCallback;>;"
    .end local v4           #size:I
    .end local v5           #sp:Landroid/content/SharedPreferences;
    :catchall_0
    move-exception v6

    monitor-exit v7
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v6
.end method

.method public getCurrentThemePackage()Ljava/lang/String;
    .locals 1

    .prologue
    .line 122
    iget-object v0, p0, Lcom/netease/newsreader/util/ThemeSettingsHelper;->mThemePackageName:Ljava/lang/String;

    return-object v0
.end method

.method public getThemeColor(Landroid/content/Context;I)Landroid/content/res/ColorStateList;
    .locals 1
    .parameter "context"
    .parameter "resID"

    .prologue
    .line 222
    invoke-direct {p0, p1, p2}, Lcom/netease/newsreader/util/ThemeSettingsHelper;->getThemeResource(Landroid/content/Context;I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/content/res/ColorStateList;

    return-object v0
.end method

.method public getThemeDrawable(Landroid/content/Context;I)Landroid/graphics/drawable/Drawable;
    .locals 1
    .parameter "context"
    .parameter "resID"

    .prologue
    .line 211
    invoke-direct {p0, p1, p2}, Lcom/netease/newsreader/util/ThemeSettingsHelper;->getThemeResource(Landroid/content/Context;I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/graphics/drawable/Drawable;

    return-object v0
.end method

.method public isDefaultTheme()Z
    .locals 2

    .prologue
    .line 126
    const-string v0, "default_theme"

    iget-object v1, p0, Lcom/netease/newsreader/util/ThemeSettingsHelper;->mThemePackageName:Ljava/lang/String;

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    return v0
.end method

.method public registerThemeCallback(Lcom/netease/newsreader/util/ThemeSettingsHelper$ThemeCallback;)V
    .locals 3
    .parameter "callback"

    .prologue
    .line 158
    iget-object v1, p0, Lcom/netease/newsreader/util/ThemeSettingsHelper;->mCallbacks:Ljava/util/ArrayList;

    monitor-enter v1

    .line 159
    if-nez p1, :cond_0

    .line 160
    :try_start_0
    monitor-exit v1

    .line 168
    :goto_0
    return-void

    .line 162
    :cond_0
    iget-object v0, p0, Lcom/netease/newsreader/util/ThemeSettingsHelper;->mCallbacks:Ljava/util/ArrayList;

    new-instance v2, Ljava/lang/ref/WeakReference;

    invoke-direct {v2, p1}, Ljava/lang/ref/WeakReference;-><init>(Ljava/lang/Object;)V

    invoke-virtual {v0, v2}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 163
    invoke-interface {p1}, Lcom/netease/newsreader/util/ThemeSettingsHelper$ThemeCallback;->applyTheme()V

    .line 158
    monitor-exit v1

    goto :goto_0

    :catchall_0
    move-exception v0

    monitor-exit v1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0
.end method

.method public setImageViewSrc(Landroid/app/Activity;II)V
    .locals 1
    .parameter "activity"
    .parameter "viewid"
    .parameter "resID"

    .prologue
    .line 307
    invoke-virtual {p1, p2}, Landroid/app/Activity;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/ImageView;

    .line 308
    .local v0, view:Landroid/widget/ImageView;
    if-eqz v0, :cond_0

    .line 309
    invoke-virtual {p0, p1, v0, p3}, Lcom/netease/newsreader/util/ThemeSettingsHelper;->setImageViewSrc(Landroid/content/Context;Landroid/widget/ImageView;I)V

    .line 311
    :cond_0
    return-void
.end method

.method public setImageViewSrc(Landroid/content/Context;Landroid/widget/ImageView;I)V
    .locals 1
    .parameter "context"
    .parameter "view"
    .parameter "resID"

    .prologue
    .line 295
    invoke-virtual {p0, p1, p3}, Lcom/netease/newsreader/util/ThemeSettingsHelper;->getThemeDrawable(Landroid/content/Context;I)Landroid/graphics/drawable/Drawable;

    move-result-object v0

    invoke-virtual {p2, v0}, Landroid/widget/ImageView;->setImageDrawable(Landroid/graphics/drawable/Drawable;)V

    .line 297
    return-void
.end method

.method public setListViewDivider(Landroid/app/Activity;II)V
    .locals 1
    .parameter "activity"
    .parameter "viewid"
    .parameter "resID"

    .prologue
    .line 357
    invoke-virtual {p1, p2}, Landroid/app/Activity;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/ListView;

    .line 358
    .local v0, view:Landroid/widget/ListView;
    if-eqz v0, :cond_0

    .line 359
    invoke-virtual {p0, p1, v0, p3}, Lcom/netease/newsreader/util/ThemeSettingsHelper;->setListViewDivider(Landroid/content/Context;Landroid/widget/ListView;I)V

    .line 361
    :cond_0
    return-void
.end method

.method public setListViewDivider(Landroid/content/Context;Landroid/widget/ListView;I)V
    .locals 1
    .parameter "context"
    .parameter "view"
    .parameter "resID"

    .prologue
    .line 346
    invoke-virtual {p0, p1, p3}, Lcom/netease/newsreader/util/ThemeSettingsHelper;->getThemeDrawable(Landroid/content/Context;I)Landroid/graphics/drawable/Drawable;

    move-result-object v0

    invoke-virtual {p2, v0}, Landroid/widget/ListView;->setDivider(Landroid/graphics/drawable/Drawable;)V

    .line 347
    return-void
.end method

.method public setListViewSelector(Landroid/app/Activity;II)V
    .locals 1
    .parameter "activity"
    .parameter "viewid"
    .parameter "resID"

    .prologue
    .line 332
    invoke-virtual {p1, p2}, Landroid/app/Activity;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/ListView;

    .line 333
    .local v0, view:Landroid/widget/ListView;
    if-eqz v0, :cond_0

    .line 334
    invoke-virtual {p0, p1, v0, p3}, Lcom/netease/newsreader/util/ThemeSettingsHelper;->setListViewSelector(Landroid/content/Context;Landroid/widget/ListView;I)V

    .line 336
    :cond_0
    return-void
.end method

.method public setListViewSelector(Landroid/content/Context;Landroid/widget/ListView;I)V
    .locals 1
    .parameter "context"
    .parameter "view"
    .parameter "resID"

    .prologue
    .line 321
    invoke-virtual {p0, p1, p3}, Lcom/netease/newsreader/util/ThemeSettingsHelper;->getThemeDrawable(Landroid/content/Context;I)Landroid/graphics/drawable/Drawable;

    move-result-object v0

    invoke-virtual {p2, v0}, Landroid/widget/ListView;->setSelector(Landroid/graphics/drawable/Drawable;)V

    .line 322
    return-void
.end method

.method public setTextViewColor(Landroid/app/Activity;II)V
    .locals 1
    .parameter "activity"
    .parameter "viewid"
    .parameter "resID"

    .prologue
    .line 382
    invoke-virtual {p1, p2}, Landroid/app/Activity;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/TextView;

    .line 383
    .local v0, view:Landroid/widget/TextView;
    if-eqz v0, :cond_0

    .line 384
    invoke-virtual {p0, p1, v0, p3}, Lcom/netease/newsreader/util/ThemeSettingsHelper;->setTextViewColor(Landroid/content/Context;Landroid/widget/TextView;I)V

    .line 386
    :cond_0
    return-void
.end method

.method public setTextViewColor(Landroid/content/Context;Landroid/widget/TextView;I)V
    .locals 1
    .parameter "context"
    .parameter "view"
    .parameter "resID"

    .prologue
    .line 371
    invoke-virtual {p0, p1, p3}, Lcom/netease/newsreader/util/ThemeSettingsHelper;->getThemeColor(Landroid/content/Context;I)Landroid/content/res/ColorStateList;

    move-result-object v0

    invoke-virtual {p2, v0}, Landroid/widget/TextView;->setTextColor(Landroid/content/res/ColorStateList;)V

    .line 372
    return-void
.end method

.method public setViewBackgroud(Landroid/app/Activity;II)V
    .locals 1
    .parameter "activity"
    .parameter "viewid"
    .parameter "resID"

    .prologue
    .line 255
    invoke-virtual {p1, p2}, Landroid/app/Activity;->findViewById(I)Landroid/view/View;

    move-result-object v0

    .line 256
    .local v0, view:Landroid/view/View;
    if-eqz v0, :cond_0

    .line 257
    invoke-virtual {p0, p1, v0, p3}, Lcom/netease/newsreader/util/ThemeSettingsHelper;->setViewBackgroud(Landroid/content/Context;Landroid/view/View;I)V

    .line 259
    :cond_0
    return-void
.end method

.method public setViewBackgroud(Landroid/content/Context;Landroid/view/View;I)V
    .locals 1
    .parameter "context"
    .parameter "view"
    .parameter "resID"

    .prologue
    .line 244
    invoke-virtual {p0, p1, p3}, Lcom/netease/newsreader/util/ThemeSettingsHelper;->getThemeDrawable(Landroid/content/Context;I)Landroid/graphics/drawable/Drawable;

    move-result-object v0

    invoke-virtual {p2, v0}, Landroid/view/View;->setBackgroundDrawable(Landroid/graphics/drawable/Drawable;)V

    .line 245
    return-void
.end method

.method public setViewBackgroudColor(Landroid/app/Activity;II)V
    .locals 1
    .parameter "activity"
    .parameter "viewid"
    .parameter "resID"

    .prologue
    .line 280
    invoke-virtual {p1, p2}, Landroid/app/Activity;->findViewById(I)Landroid/view/View;

    move-result-object v0

    .line 281
    .local v0, view:Landroid/view/View;
    if-eqz v0, :cond_0

    .line 282
    invoke-virtual {p0, p1, v0, p3}, Lcom/netease/newsreader/util/ThemeSettingsHelper;->setViewBackgroudColor(Landroid/content/Context;Landroid/view/View;I)V

    .line 284
    :cond_0
    return-void
.end method

.method public setViewBackgroudColor(Landroid/content/Context;Landroid/view/View;I)V
    .locals 1
    .parameter "context"
    .parameter "view"
    .parameter "resID"

    .prologue
    .line 269
    invoke-virtual {p0, p1, p3}, Lcom/netease/newsreader/util/ThemeSettingsHelper;->getThemeColor(Landroid/content/Context;I)Landroid/content/res/ColorStateList;

    move-result-object v0

    invoke-virtual {v0}, Landroid/content/res/ColorStateList;->getDefaultColor()I

    move-result v0

    invoke-virtual {p2, v0}, Landroid/view/View;->setBackgroundColor(I)V

    .line 270
    return-void
.end method

.method public setWindowBackgroud(Landroid/app/Activity;I)V
    .locals 2
    .parameter "activity"
    .parameter "resID"

    .prologue
    .line 233
    invoke-virtual {p1}, Landroid/app/Activity;->getWindow()Landroid/view/Window;

    move-result-object v0

    invoke-virtual {p0, p1, p2}, Lcom/netease/newsreader/util/ThemeSettingsHelper;->getThemeDrawable(Landroid/content/Context;I)Landroid/graphics/drawable/Drawable;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/view/Window;->setBackgroundDrawable(Landroid/graphics/drawable/Drawable;)V

    .line 234
    return-void
.end method

.method public unRegisterThemeCallback(Lcom/netease/newsreader/util/ThemeSettingsHelper$ThemeCallback;)V
    .locals 6
    .parameter "callback"

    .prologue
    .line 136
    iget-object v5, p0, Lcom/netease/newsreader/util/ThemeSettingsHelper;->mCallbacks:Ljava/util/ArrayList;

    monitor-enter v5

    .line 137
    if-eqz p1, :cond_0

    .line 138
    :try_start_0
    iget-object v4, p0, Lcom/netease/newsreader/util/ThemeSettingsHelper;->mCallbacks:Ljava/util/ArrayList;

    invoke-virtual {v4}, Ljava/util/ArrayList;->size()I

    move-result v3

    .line 139
    .local v3, size:I
    new-instance v2, Ljava/util/ArrayList;

    invoke-direct {v2}, Ljava/util/ArrayList;-><init>()V

    .line 140
    .local v2, removeList:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Ljava/lang/ref/WeakReference<Lcom/netease/newsreader/util/ThemeSettingsHelper$ThemeCallback;>;>;"
    const/4 v0, 0x0

    .local v0, i:I
    :goto_0
    if-lt v0, v3, :cond_1

    .line 146
    iget-object v4, p0, Lcom/netease/newsreader/util/ThemeSettingsHelper;->mCallbacks:Ljava/util/ArrayList;

    invoke-virtual {v4, v2}, Ljava/util/ArrayList;->removeAll(Ljava/util/Collection;)Z

    .line 136
    .end local v0           #i:I
    .end local v2           #removeList:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Ljava/lang/ref/WeakReference<Lcom/netease/newsreader/util/ThemeSettingsHelper$ThemeCallback;>;>;"
    .end local v3           #size:I
    :cond_0
    monitor-exit v5

    .line 149
    return-void

    .line 141
    .restart local v0       #i:I
    .restart local v2       #removeList:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Ljava/lang/ref/WeakReference<Lcom/netease/newsreader/util/ThemeSettingsHelper$ThemeCallback;>;>;"
    .restart local v3       #size:I
    :cond_1
    iget-object v4, p0, Lcom/netease/newsreader/util/ThemeSettingsHelper;->mCallbacks:Ljava/util/ArrayList;

    invoke-virtual {v4, v0}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Ljava/lang/ref/WeakReference;

    .line 142
    .local v1, r:Ljava/lang/ref/WeakReference;,"Ljava/lang/ref/WeakReference<Lcom/netease/newsreader/util/ThemeSettingsHelper$ThemeCallback;>;"
    invoke-virtual {v1}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object v4

    if-eqz v4, :cond_2

    invoke-virtual {v1}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object v4

    invoke-virtual {p1, v4}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

    move-result v4

    if-eqz v4, :cond_3

    .line 143
    :cond_2
    invoke-virtual {v2, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 140
    :cond_3
    add-int/lit8 v0, v0, 0x1

    goto :goto_0

    .line 136
    .end local v0           #i:I
    .end local v1           #r:Ljava/lang/ref/WeakReference;,"Ljava/lang/ref/WeakReference<Lcom/netease/newsreader/util/ThemeSettingsHelper$ThemeCallback;>;"
    .end local v2           #removeList:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Ljava/lang/ref/WeakReference<Lcom/netease/newsreader/util/ThemeSettingsHelper$ThemeCallback;>;>;"
    .end local v3           #size:I
    :catchall_0
    move-exception v4

    monitor-exit v5
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v4
.end method
